#include "display.h"
#include <TFT_eSPI.h>
#include <SPI.h>

extern TFT_eSPI tft;

// tft.fillScreen(TFT_BLACK);
// tft.drawString("key_up ", 0, 0);
void clear_display(void)
{
    tft.fillScreen(TFT_BLACK);
}
void show_string(uint8_t line, char *str, uint8_t mode)
{
    uint8_t y = line * 26;
    if (mode == 1)
    {
        tft.setTextColor(TFT_BLACK, TFT_WHITE, true);
        tft.drawString(str, 0, y);
    }
    else
    {
        tft.setTextColor(TFT_WHITE, TFT_BLACK, true);
        tft.drawString(str, 0, y);
    }
}
void show_number(uint8_t line, long num, uint8_t mode)
{
    uint8_t y = line * 26;
    if (mode == 1)
    {
        tft.setTextColor(TFT_BLACK, TFT_WHITE, true);
        tft.drawNumber(num, 0, y);
    }
    else
    {
        tft.setTextColor(TFT_WHITE, TFT_BLACK, true);
        tft.drawNumber(num, 0, y);
    }
}

void set_brightness(uint8_t dutyCycle)
{
    // ledcWrite(0, dutyCycle);
    analogWrite(11,dutyCycle);
}